import React from "react";
import Text from "react-native-svg/elements/Text";
import {Animated} from "react-native";


class SwingText extends React.Component {

  shouldComponentUpdate(nextProps){
    return this.props.swing !== nextProps.swing;
  }

  render() {
    const {x, y,swing} = this.props;
    const realY = y-swing;
    return (
      <Text
        x={x}
        y={realY}
        textAnchor="middle"
        fontSize="16"
        fill="#00ff00"
      >+20</Text>
    )
  }
}

export const AnimatedText = Animated.createAnimatedComponent(SwingText);
